Memory word array organization and prediction combination for memory access

ABSTRACT

Described systems and methods allow a reduction in the memory bandwidth required in video coding (decoding/encoding) applications. According to a first aspect, the data assigned to each memory word is chosen to correspond to a 2D subarray of a larger array such as a macroblock. An array memory word organization allows reducing both the average and worst-case bandwidth required to retrieve predictions from memory in video coding applications, particularly for memory word sizes (memory bus widths) larger than the size of typical predictions. According to a second aspect, two or more 2D subarrays such as video predictions are retrieved from memory simultaneously as part of a larger 2D array, if retrieving the larger array requires fewer clock cycles than retrieving the subarrays individually. Allowing the combination of multiple predictions in one memory access operation can lead to a reduction in the average bandwidth required to retrieve predictions from memory.

CROSS REFERENCE TO RELATED PATENT APPLICATIONS

This application is a continuation application of and claims priority toclaims priority under 35 U.S.C. §120 to U.S. patent application Ser. No.10/794,280, filed Mar. 3, 2004, entitled “Memory Word Array Organizationand Prediction Combination for Memory Access,” which claims the benefitof the filing date of U.S. Provisional Patent Application No.60/451,882, filed Mar. 3, 2003, entitled “Memory Word Array Organizationand Prediction Combination for Memory Access.” Each of theaforementioned patent applications is herein incorporated by reference.This application is also related to U.S. patent application Ser. No.10/215,705, filed Aug. 9, 2002, entitled “Random Access MemoryController with Out of Order Execution,” which is also hereinincorporated by reference.

COPYRIGHT NOTICE

This disclosure contains material, such as exemplary C-code, which issubject to copyright protection. The copyright owner, MobilygenCorporation, has no objection to the facsimile reproduction by anyone ofthe patent disclosure as it appears in the Patent and Trademark Officepatent file or records of any country, but otherwise reserves all rightswhatsoever.

BACKGROUND

This invention relates to random access memories (RAM), and inparticular to systems and methods for storing two-dimensional array datasuch as video images in RAM.

Emerging applications such as high-definition television (HDTV), whichentail increasing resolutions and data transfer rates, pose newchallenges to the design of real-time video coding systems. Asprocessing power and memory capacity costs have steadily declined,memory bandwidth is becoming an increasingly important constraint on theperformance and cost of video coding systems.

SUMMARY OF THE INVENTION

The present invention provides systems and methods allowing a reductionin the memory bandwidth required in video coding applications. Accordingto a first aspect, the data assigned to each memory word is chosen tocorrespond to a 2D subarray of a larger array such as a macroblock. Anarray memory word organization allows reducing both the average andworst-case bandwidth required to retrieve predictions from memory invideo coding applications, particularly for memory word sizes (memorybus widths) larger than the size of typical predictions. According to asecond aspect, two or more 2D subarrays such as video predictions areretrieved from memory together as part of a larger 2D array, ifretrieving the larger array requires fewer clock cycles than retrievingthe subarrays individually. Allowing the combination of multiplepredictions in one memory access operation can allow a reduction in theaverage bandwidth required to retrieve predictions from memory.

BRIEF DESCRIPTION OF THE DRAWINGS

The foregoing aspects and advantages of the present invention willbecome better understood upon reading the following detailed descriptionand upon reference to the drawings where:

FIG. 1 is a high-level diagram of an exemplary data processing systemaccording to an embodiment of the present invention.

FIG. 2 shows an exemplary memory controller according to an embodimentof the present invention.

FIGS. 3-A-B illustrate schematically the difference between aconventional linear memory word organization and an array memory wordorganization, according to one aspect of the present invention.

FIGS. 4-A-B illustrate schematically the worst-case memory bandwidthsavings achievable with an array memory word organization, for anexemplary 4×4-byte prediction and a 64 bit memory bus (8 byte memoryword), according an embodiment of the present invention.

FIG. 5 shows two individual predictions and a combined predictionresulting from combining the two individual predictions, according toone aspect of the present invention.

FIGS. 6-A-D illustrate a prediction arrangement in which three describedprediction combination functions can yield different results, accordingto an embodiment of the present invention.

FIGS. 7-A-D show computed memory bandwidth savings, expressed as apercentage of total memory cycles, resulting from combining two 9×4predictions for a 32-bit memory bus with a linear memory wordorganization.

FIGS. 8-A-D show computed memory bandwidth savings, expressed as apercentage of total memory cycles, resulting from combining two 9×4predictions for a 32-bit memory bus with an array memory wordorganization.

DETAILED DESCRIPTION OF THE INVENTION

In the following description, a pipestage is understood to be a circuitwhich includes a finite state machine (FSM). A core is understood to bea circuit including plural interconnected pipestages. A set of elementsis understood to contain one or more elements. Any reference to anelement is understood to encompass at least one element. Any describedconnection can be a direct connection or an indirect connection throughintermediary structures/logic. Unless otherwise specified, the statementthat a first request is derived from the second request is understood tomean either that the first request is equal to the second request, orthat the first request is generated by processing the second request and(optionally) other data. Memory access operations can be memory readand/or write operations. The term “coding” encompasses both encoding anddecoding. Unless otherwise specified, the term “rectangle” encompassesboth symmetric rectangles (squares) and asymmetric rectangles. Unlessotherwise specified, an N×M rectangle may be a rectangle having itshorizontal or vertical dimension characterized by the number N.

The following description illustrates embodiments of the invention byway of example and not necessarily by way of limitation. Forillustrative purposes, the following discussion focuses on exemplaryvideo data encoding/decoding systems, and in particular on systemsdesigned to operate according to the emerging H.264 (MPEG-4 Part 10)standard. Other hardware configurations than the one described below canbe employed to implement systems and methods of the present invention.Moreover, the memory word organization and 2D array (e.g. prediction)combination schemes described below can be used with non-videomultidimensional (e.g. 2D or 3D) data.

MPEG (Moving Pictures Experts Group) denotes a family of widely usedvideo compression standards, including MPEG-1, MPEG-2 and MPEG-4. MPEGvideo coding (encoding and/or decoding) typically combines severalapproaches to video compression, including entropy coding, discretecosine or Hadamard transform, quantization, and motion compensation.Motion compensation reduces the amount of data needed to store ortransmit a video image sequence by exploiting the temporal redundancy ofcommon video image sequences. In typical video sequences, an object orimage block displayed in one video frame can be found in a subsequentframe at the same location or at a displaced location. Rather thanencode the data corresponding to the image block a second time, an MPEGencoder can encode an instruction to use a block of data from a previousframe, a motion vector describing the difference in the block locationsbetween the two frames, and residual data describing the differencesbetween the image blocks at the two locations.

Such an image block from a previous image is commonly called aprediction. An image block 16×16-bytes in size is commonly called amacroblock. Generally, a macroblock may contain one or more predictions.Employing smaller predictions can allow a reduction in the amount ofresidual data, but at the same time require an increase in the amount ofmotion vector data encoded. An optimal prediction size for a particularpart of an image displayed in two frames can depend on the similaritiesin the corresponding data between the two frames. Retrieving predictionsfrom memory can account for a majority of the memory bandwidth used byan MPEG decoder.

MPEG video data includes three components: one luminance (luma) plane(Y) and two chrominance (chroma) planes (Cb and Cr). Chrominance data istypically sampled at half the resolution of luminance data. The twochrominance components use the same prediction, so a picture can bestored in memory in two planes: one for luma and one for chroma, withalternating bytes in memory assigned to Cb and Cr. Commonly, aprediction can be a block of 4×4, 4×8, 8×4, 8×8, 8×16, 16×8, or 16×16luma samples plus two blocks of quarter size (half size horizontally andvertically) of chroma samples read from a reference picture. Forsimplicity, the following discussion focuses primarily on the lumaplane. The described array memory word arrangements and predictioncombination approach can be applied to chroma data as well.

Exemplary Hardware Environment for Video Encoding/Decoding Applications

FIG. 1 is schematic diagram of an exemplary data processing system 20according to an embodiment of the present invention. Data processingsystem 20 includes a random access memory (RAM) such as a dynamic randomaccess memory (DRAM) 22, a plurality of clients 24 a-c, and a memorycontroller 26 connecting clients 24 a-c and memory 22, for controllingmemory 22 according to requests received from clients 24 a-c. Exemplaryformats for memory 22 include, without limitation, single-data rateSDRAM (SDR-SDRAM) and double-data rate SDRAM (DDR-I or DDR-II SDRAM).Memory 22 is connected to memory controller 26 through conventionalcommand and data write/read signal drivers 30 a-b, respectively. Signaldrivers 30 a-b are preferably memory pads with registers, and serve toensure compliance with memory timing constraints. Clients 24 a-c can bespecial-purpose hardware modules, as well as programmed general-purposeprocessors. Memory 22 can include a plurality ofindependently-addressable banks, each of which is organized as aplurality of pages (rows). A memory page is conventionally organized asa plurality of memory words, wherein each memory word contains a numberof bits equal to the width of the memory data bus. Each memoryword/location within a bank is characterized by a row (page) address anda column address. Writing or reading data to/from memory normallyrequires one clock cycle per memory word accessed.

FIG. 2 shows a high-level schematic diagram of an exemplary memorycontroller 26 suitable for use in a video coding (encoding/decoding)system, according to an embodiment of the present invention. Memorycontroller 26 includes a client arbiter 36 capable of communication withplural clients, a virtual-to-physical address translation (VPAT) unit 38connected to client arbiter 36, a physical memory controller (PMC) 40connected to VPAT unit 38, and write and read caches 62 a-b connected tomemory 22 and client arbiter 36. Caches 62 a-b provide buffering andreordering functions described below, and can be thought of as formingpart of client arbiter 36. Memory controller 26 also includes apartition management unit (PMU) 44 connected to VPAT unit 38, and decodedisplay interlock (DDI) unit 46 connected to client arbiter 36 and PMU44. Memory controller 26 controls the operation of memory 22, asdescribed in further detail below. DDI unit 46 performs decode/displayinterlocking, while PMU 44 is a central repository for informationregarding memory partitions and any video/graphics frames stored inthem.

In one embodiment, each unit of memory controller 26 may be adata-driven core capable of communication with other cores according toa ready/request handshake protocol. In one implementation, a token istransferred from a first core to a second core if and only if the firstcore asserts a ready signal to the second core, and the second coreasserts a request signal to the first core on the same clock cycle(synchronously). For further information on such a ready/requestprotocol and core architecture see U.S. Pat. No. 6,145,073. Generally,the various units of memory controller 26 can be interconnected usingother desired protocols/connections.

Client arbiter 36 comprises a dynamic memory arbiter 50, a datamultiplexer/register unit 52 connected to dynamic memory arbiter 50, anda cache controller unit 54 connected to the multiplexer/register unit 52and to caches 62 a-b. Dynamic memory arbiter 36 is connected to multipleclients over corresponding client command connections 58, whilemultiplexer/register unit 52 is connected to the clients overcorresponding data connections 60. Cache controller unit 54 controls theoperation of read and write caches 62 a-b in response to commandsreceived from PMC 40 and client data received from unit 52. Inparticular, in one implementation, cache controller unit 54 is employedto implement the 2D-subarray memory word organization scheme describedbelow, by reordering the data received and sent to/from caches 62 a-b.Cache controller unit 54 may also be capable of reformatting the datasent to/from caches 62 a-b to match the formats employed by memory 22and various clients. For example, if the memory bus connecting caches 62a-b to memory 22 is 64-bit wide while a specific client bus is 16-bitwide, cache controller 54 may be capable of receiving 64-bit memorywords from memory 22 and sending the data sequentially as 16-bit tokensto the corresponding client.

Client arbiter 36 receives memory access (read/write) requests fromplural clients, and arbitrates the requests. Client arbiter 36 allowsonly one request at a time to proceed to VPAT unit 38, and attaches aclient identification (ID) label to each request allowed to proceed. Theclient selection decision made by client arbiter 36 can be madeaccording to a predetermined protocol, for example using a round-robinpriority scheme. The client requests received by client arbiter 36 mayhave one of a plurality of virtual (client, logical) address formats,each corresponding to a mode of operation of memory controller 26. Forexample, modes such as linear, frame, field, and array can be useful foraccessing stored video images. In linear mode, the client requestincludes a virtual (client) start address, a transaction length, and atransaction type (read/write). In frame mode, the client request caninclude start X and Y image coordinates, ΔX and ΔY image extents, and atransaction type. The field mode is similar to the frame mode, exceptthat only every other line in the image is accessed. In array mode, theclient request includes a virtual start address, a transaction length, astride, and a period number N. Such a request corresponds to accessing atransaction length following the start address, then skipping a strideminus transaction length to arrive at a new start address, and thenrepeating the above process N times.

VPAT unit 38 receives one client request at a time from client arbiter36, breaks each block request (e.g. frame, field or array mode request)into a set of linear requests, and translates any virtual addresses fromthe client requests into physical addresses to be sent to PMC 40. Aphysical address can be equal to, for example, the sum of a function ofthe received virtual address (e.g. f(X,Y), where X and Y are start imagecoordinates) and a base address for the corresponding client, whereineach client has a different base address. VPAT unit 38 sends theresulting linear requests to PMC 40. PMC 40 controls the operation ofmemory 22 according to the commands received from VPAT 38. An exemplaryimplementation for PMC 40 is described in detail in U.S. patentapplication Ser. No. 10/215,705, filed Aug. 9, 2002, entitled “RandomAccess Memory Controller with Out of Order Execution.” Other physicalmemory controller designs suitable for use in the present invention areknown in the art.

Data reordering logic and buffers used to implement the memory wordarray organization described below may be situated in various locationswithin a data processing system. In some embodiments, the memory wordorganization described below is implemented within client arbiter 36,and in particular within cache controller 54. The memory wordorganization may also be implemented situated within clients capable ofoperating on array words. The prediction combination approach describedbelow may be implemented within any client that retrieves predictionsfrom memory, such as clients implementing motion compensationfunctionality. Implementing the described memory word organizationwithin memory controller 26 allows separating client design from memoryparameters. In general, the memory word organization and predictioncombination systems and methods described below could be implementedwithin a memory controller, clients connected to the memory controller,or other data processing modules.

Memory Word Array Organization

In conventional memory controllers, a memory word contains consecutivebytes from the same line in a 2D video image. Such a memory organizationis referred to below as a linear memory word organization. For 8-, 16-,or 32-bit memory words and corresponding memory bus widths, the memoryword size is normally smaller than the size of predictions commonly usedin video data decoding. For such bus widths, reading a prediction frommemory normally requires reading multiple words from memory. For 64-bit,128-bit or larger memory words, the memory word size can be larger thanthe size of at least some predictions. At the same time, because ingeneral a prediction may start at an arbitrary position within a memoryword, reading a prediction from memory may require reading two wordsunder a worst-case scenario, regardless of how wide the memory bus is.Thus, with a linear memory word organization, increasing the width ofthe memory bus may not provide sufficient memory bandwidth to allowworst-case prediction access in one memory access operation.

The bandwidth required for reading 2D predictions from memory can bereduced by assigning to each memory word a 2D rectangular subarraysimilar in shape and size to the predictions to be read. Table 1 listspreferred word organizations for several memory bus widths:

TABLE 1 Bus Width (bits) 8 16 32 64 128 256 512 Word Organization 1 * 12 * 1 2 * 2 4 * 2 4 * 4 8 * 4 8 * 8 (bytes)

For a (8×2^(n))-bit bus width, each memory word is preferably assignedto an M×N image subarray, with M=2^(n)/2^(n>>1), and N=2^(n>>1). Thenotation n>>1 refers to right-shifting the binary representation of n byone bit, i.e. dividing n by 2 and rounding down. As Table 1 illustrates,a preferred subarray shape is square if the number of bytes in a word isan even power of two, and a 2:1 aspect-ratio rectangle if the number ofbytes in a word is an odd power of two. Preferably, for asymmetricsubarrays, the horizontal size is double that of the vertical size,although in general the vertical size can be chosen to be larger thanthe horizontal size. Having the horizontal size larger than or equal tothe vertical size can allow the memory word shape to better match theshape of chroma data, and thus reduce the bandwidth required for readingchroma predictions.

FIGS. 3-A-B illustrate schematically the difference between aconventional linear memory word organization and an array memory wordorganization according to an embodiment of the present invention. Theillustrations of FIGS. 3-A-B are not to scale. FIG. 3-A shows part of animage 80 including four image lines 82. A memory word is assigned to alinear image region 86 located along one of the lines 82. FIG. 3-Billustrates a corresponding rectangular 2D subarray 88 assigned to amemory word in an array memory word organization. Subarray 88 can spanmultiple display lines 82.

FIGS. 4-A-B illustrate schematically the worst-case memory bandwidthsavings achievable with an array memory word organization, for anexemplary 4×4-byte prediction 96 and a 64 bit memory bus (8 byte memoryword). FIG. 4-A shows that 8 linear memory words 86 must be retrievedfrom memory in order to reconstruct prediction 96 in a worst-casesituation. As shown in FIG. 4-B, only 6 array memory words 88 need to beretrieved from memory to reconstruct 96 in a worst case situation. Ifthe start of the prediction data were to coincide with the start of thememory words in the two arrangements, a linear word arrangement wouldrequire 4 clock cycles, while the array word arrangement would requireonly 2 clock cycles to retrieve prediction 96.

Combining 2D Arrays/Predictions

Further average memory bandwidth savings can be achieved by combiningthe retrieval of multiple 2D arrays such as predictions, as describedbelow. The methods of combining predictions described below can be usedwith both linear and array memory word organizations. The predictioncombination methods described below may be implemented using suitablelogic situated within any motion compensation or other clients that needto retrieve predictions or other 2D array data from memory.

Consider an arbitrary 16×16-byte macroblock constrained to correspond toat most 32 predictions sized 4×4, 4×8, 8×4, 8×8, 8×16, 16×8, or 16×16bytes. The predictions can come from one or two pictures, with at most16 predictions from the same picture. A video encoder normally starts byfinding a reasonable 16×16-byte prediction for the entire macroblock.The encoder then attempts to select an optimal prediction set within thelimited time allowed to process the macroblock, for example by dividingthe macroblock in several smaller blocks and evaluating differentpositions for the smaller blocks. Statistically, the positions ofdifferent predictions selected by such a process are highly correlated.About 50% of adjacent predictions overlap by at least a few pels. Manyother adjacent predictions are a few pels or quarter pels apart. Thus,at least in some instances, memory bandwidth can be saved by readingfrom memory a combined prediction defined by the minimal image rectanglecontaining the two predictions, instead of reading the two predictionsindividually. Moreover, if the memory bus is wider than the memory spacerequired to store data for one pixel (e.g. 1 byte), memory bandwidth canbe saved by retrieving a combined prediction even if two adjacentpredictions do not overlap, since retrieving the memory words requiredto reconstruct one prediction can require retrieving additional bitswhich form part of another prediction.

FIG. 5 shows a combined prediction 122 which can be read from memoryinstead of two individual predictions 120 a-b. By retrieving thecombined prediction 122 from memory, a prediction overlap area 126 isretrieved only once. Overlap area 126 would be retrieved from memorytwice if predictions 120 a-b were read individually. The memorybandwidth saved by retrieving overlap area 126 only once can be higherthan the additional bandwidth needed to retrieve two unneeded areas 124a-b.

Table 2 shows exemplary C-code for a prediction combination functioncombine_prediction( ) suitable for combining two predictions accordingto a preferred embodiment of the present invention.

TABLE 2 bool combine_predictions (Pred *Pred0, Pred *Pred1) {  boolflag;  int HAddr, VAddr, HSize, VSize;  int Cycles, Cycles0, Cycles1; //compute address and size of the combined prediction  HAddr = Pred0->HAddr <  Pred1->HAddr ? Pred0->HAddr : Pred1->HAddr;  VAddr = Pred0->VAddr <  Pred1->VAddr ? Pred0->VAddr : Pred1->VAddr;  HSize =(Pred0->HAddr + Pred0->HSize  > Pred1->HAddr + Pred1->HSize ? Pred0->HAddr + Pred0->HSize   : Pred1->HAddr + Pred1->HSize) − HAddr; VSize = (Pred0->VAddr + Pred0->VSize  > Pred1->VAddr + Pred1->VSize ? Pred0->VAddr + Pred0->VSize   : Pred1->VAddr + Pred1->VSize) − VAddr;// number of cycles needed to read the predictions  Cycles= cycles(    HAddr,     VAddr,     HSize,    VSize);  Cycles0= cycles(Pred0->HAddr, Pred0->VAddr, Pred0->HSize, Pred0->VSize); Cycles1 = cycles(Pred1->HAddr, Pred1->VAddr, Pred1->HSize,Pred1->VSize);  if (Cycles <= Cycles0 + Cycles1)  {   flag = 1; //combine predictions   Pred0->HOffset = Pred0->HAddr − HAddr;  Pred0->VOffset = Pred0->VAddr − VAddr;   Pred0->Haddr =        HAddr;  Pred0->Vaddr =        VAddr;   Pred1->HOffset = Pred1->HAddr − HAddr;  Pred1->VOffset = Pred1->VAddr − VAddr;   Pred1->Combine = Pred0;  } else flag = 0; // do not combine predictions  return (flag); }

The combine_prediction( ) function takes as input two predictions andcomputes the address and size of the combined prediction. It returns alogical TRUE value when predictions should be combined, i.e. if memorybandwidth will be saved by combining the predictions. Predictions may becombined even when the combined prediction requires the same number ofcycles as the two separate predictions, in order to allow achievingextra bandwidth savings as the procedure is applied iteratively toadditional predictions.

The combine_prediction( ) function shown in Table 2 may make use of thedata structures and memory organization constants defined in Table 3.The Pred structure holds the prediction horizontal and vertical address,size, and offset, plus a combine pointer to another Pred structure. Theoffsets are initialized with 0 and the Combine pointer with NULL. If thecombine_prediction ( ) function decides to combine the two predictions,it changes the Combine pointer of the second prediction to point to thefirst prediction, changes the horizontal and vertical address of thefirst prediction to the address of the combined prediction, and sets thehorizontal and vertical offsets of both predictions to reflect therelative positions to the combined prediction. The cycles( ) macrocomputes the number of cycles needed to read a prediction. If Linear isdefined, the macro computes the number of cycles assuming a linear wordorganization. The macro otherwise assumes an array word organization.

TABLE 3 int N; // Number of predictions Pred *Predictions[ ]; // arrayof pointers to predictions typedef struct pred // Prediction structure { pred *Combine; // Pointer to Combined Prediction // if (Combine ==NULL), prediction is not combined  int HAddr; // Horizontal Address(used only when Combined == NULL)  int VAddr; // Vertical  Address (usedonly when Combined == NULL)  int HSize; // Horizontal Size  int VSize;// Vertical  Size  int HOffset; // Horizontal Offset (shall beinitialized with 0)  int VOffset; // Vertical  Offset (shall beinitialized with 0) } Pred;  int tmp;  int  Bytes,  MBits,  Mask;  intHBytes, HMBits, HMask;  int VBytes, VMBits, VMask; // compute somememory organization constants  Bytes = MWidth >> 3; // number of Bytesin a memory word  MBits = 0; // number of Bits needed to address Bytes tmp  = Bytes;  while (tmp >>= 1) MBits++;  Mask  = (1 << MBits) − 1; //Bytes address Mask // number of cycles needed to read a prediction#ifdef Linear  #define cycles(HAddr, VAddr, HSize, VSize) \       (((HAddr & Mask) + HSize + Bytes − 1) >> MBits) * VSize; #else // Array  VMBits = MBits >> 1; // number of Bits needed to addressVBytes  HMBits = MBits − VMBits; // number of Bits needed to addressHBytes  HBytes =  1 << HMBits; // number of Horizontal Bytes in a memoryword  VBytes =  1 << VMBits; // number of Vertical  Bytes in a memoryword  HMask = (1 << HMBits) − 1; // HBytes address Mask  VMask = (1 <<VMBits) − 1; // VBytes address Mask  #define Cycles(HAddr, VAddr, HSize,VSize) \        (((HAddr & HMask) + HSize + HBytes − 1) >> HMBits) * \       (((VAddr & VMask) + VSize + VBytes − 1) >> VMBits); #endif

Table 4 shows exemplary C-code for three methods of combining multiplepredictions using the combine_prediction( ) function of Table 2. Thecombine_exhaustive( ) function performs an exhaustive search of allpossible ways in which predictions can be combined to save memorybandwidth. The combine_fast( ) function attempts all possiblecombinations for a first prediction, and then repeats the process forall other higher-indexed predictions, but not lower-indexed predictions.The combine_fast( ) function is faster than the combine_exhaustive( )function, and yields the same results most of the time. Thecombine_onepass( ) function performs a fast one-pass comparison that isoften almost as good as the exhaustive search.

TABLE 4 void combine_exhaustive (void) {  bool flag;  int i, j;  for (i= 0 ; i < N ; i++)  {   if (Predictions[i]->Combine == NULL) {    do {    flag = 0;     for (j = i+1 ; j < N ; j++)     {      if(Predictions[j]->Combine == NULL) {       if(combine_predictions(Predictions[i], Predictions[j]))       flag = 1;     }     }    } while (flag);   }  } } void combine_fast (void) {  inti, j;  for (i = 0 ; i < N ; i++)  {   if (Predictions[i]->Combine ==NULL) {    for (j = i+1 ; j < N ; j++)    {     if(Predictions[j]->Combine == NULL) {     combine_predictions(Predictions[i], Predictions[j]);     }    }   } } } void combine_onepass (void) {  int i;  for (i = 1 ; i < N ; i++)  {  combine_predictions(Predictions[0], Predictions[i]);  } }

FIGS. 6-A-D illustrate a prediction arrangement in which the functionsof Table 4 can lead to different final results. FIG. 6-A shows anarrangement of four adjacent, overlapping predictions P(0-3) arranged inthe order 0, 3, 2, 1. The index assigned to each prediction can bearbitrary. FIG. 6-B shows the prediction configuration produced by thefunction combine_onepass( ). The function checks but does not combineP(0) and P(1), and P(0) and P(2). The function then combines P(0) andP(3) and names the result P(0). FIG. 6-C shows the predictionconfiguration produced by the function combine_fast( ). The functioncombine_fast ( ) performs the operations performed by combine_onepass (), and additionally it checks P(1) and P(2) and combines them into P(1).FIG. 6-D shows the prediction configuration produced by the functioncombine_exhaustive( ). The function first combines P(0) and P(3) intoP(0), then P(0) and P(2) (again into P(0)), and finally P(0) and P(1).

Performance Improvements and Applications

The discussion below is intended to illustrate several aspects andapplications of the invention according to some embodiments, and is notintended to limit the invention. The emerging H.264 (MPEG4-Part 10)standard endeavors to address the growing need for higher compression ofmoving pictures for various applications such as videoconferencing,digital storage media, television broadcasting, Internet streaming, andother communications. Next-generation video coding approaches willideally enable the use of coded video representations in a flexiblemanner for a wide variety of network environments. Such approaches willallow motion video to be manipulated as a form of computer data, storedon various storage media, transmitted and received over existing andfuture networks, and distributed on existing and future broadcastingchannels. Applications employing such a standard include, withoutlimitation, cable TV (CATV), direct broadcast satellite video services(DBS), digital subscriber line video services (DSL), digital terrestrialtelevision broadcasting (DTTB), interactive storage media such asoptical disks (ISM), multimedia mailing (MMM), multimedia services overpacket networks (MSPN), real-time conversational services such asvideoconferencing (RTC), remote video surveillance (RVS), and serialstorage media (SSM).

A proposed H.264 specification defines a plurality of levels listed inTable 5. A level is characterized by a specified set of constraintsimposed on values of the syntax elements in the bitstream. Theconstraints may limit bitstream parameter values or arithmeticcombinations of parameter values (e.g. frame width multiplied by frameheight multiplied by frame rate).

TABLE 5 Decoded Max picture Max Sample Max buffer number of ProcessingFrame memory Max Max Min MVs per Rate Size MaxKByte Video CPB VerticalMV Compress two MaxMBPS MaxFS (1024 Bit Rate Size Range ratioconsecutive Level # (MB/s) (MBs) bytes) (1000 bits/sec) (1000 bits)(full samples) MinCR MBs 1  1 485    99   148.5     64    175 [−64,+63.75] 2 — 1.1  3 000   396   337.5    192    500 [−128, +127.75] 2 —1.2  6 000   396   891.0    384  1 000 [−128, +127.75] 2 — 1.3  11 880  396   891.0    768  2 000 [−128, +127.75] 2 — 2  11 880   396   891.0  2000  2 000 [−128, +127.75] 2 — 2.1  19 800   792  1 782.0  4 000  4 000[−256, +255.75] 2 — 2.2  20 250  1 620  3 037.5  4 000  4 000 [−256,+255.75] 2 — 3  40 500  1 620  3 037.5  10 000  10 000 [−256, +255.75] 232 3.1 108 000  3 600  6 750.0  14 000  14 000 [−512, +511.75] 4 16 3.2216 000  5 120  7 680.0  20 000  20 000 [−512, +511.75] 4 16 4 245 760 8 192 12 288.0  20 000  25 000 [−512, +511.75] 4 16 4.1 245 760  8 19212 288.0  50 000  62 500 [−512, +511.75] 2 16 5 552 960 21 696 40 680.0135 000 135 000 [−512, +511.75] 2 16 5.1 983 040 36 864 69 120.0 240 000240 000 [−512, +511.75] 2 16

Level 1 corresponds to the Quarter Common Interchange Format (QCIF, or176×144@15), Level 2 to the Common Interchange Format (CIF, 352×288@30),Level 3 to Standard Definition (SD, 720×480@30 or 720×576@25), Level 3.2to 720p High Definition (1280×720@60), and Level 4 to 1080i HD(1920×1080@30). The second column in Table 1 lists the number of 16×16macroblocks per second to be processed, which is a direct measure of thecomputational complexity required for a given level. The sum of columns3, 4, and 6 in Table 5 provides an approximate measure of the memoryrequirements of each level.

Up to level 2.2, each macroblock can have up to 32 predictions. Aprediction can be a 4×4, 4×8, 8×4, 8×8, 8×16, 16×8, or 16×16 block ofluma samples, plus two blocks of quarter size (half size bothhorizontally and vertically) chroma samples read from a referencepicture. The prediction can be positioned almost anywhere in thereference picture in increments of ¼ luma samples both horizontally andvertically. Level 3 limits the number of predictions to a maximumaverage over the picture of 16 per macroblock. Above Level 3, the numberof predictions is limited to a maximum average of 8 per macroblock. Whenthe position of the prediction falls between pels in a particulardirection (horizontal or vertical), five more luma samples (one forchroma) are needed on that direction to compute the final luma (chroma)prediction based on a 6-tap (2-tap for chroma) filter. For an N×M lumaprediction, the probability is 1/16 to read an N×M block, 3/16 to read aN×(M+5) block, 3/16 to read a (N+5)×M block, and 9/16 to read a(N+5)×(M+5) block.

Table 6 provides a comparison of the worst-case number of cycles neededto retrieve a luma prediction for various prediction and memory wordsizes, for an exemplary conventional linear memory word architecture andan array memory word architecture with the memory word organization ofTable 1. Most of the prediction bandwidth is normally taken up by lumadata, so Table 6 provides a good measure of the performance improvementachievable with an array word organization. The letters H and V denotehorizontal and vertical prediction size, respectively. The columns inTable 3 correspond to different memory bus widths (memory word sizes)ranging from 8 bits to 512 bits. The last (TOTAL) line in the tableassumes an equal (unweighted) distribution of prediction sizes.

TABLE 6 Predic- tion 8 16 32 64 H V Linear Array Saved Linear ArraySaved Linear Array Saved Linear Array Saved 4 4 16 16 0% 12 12 0% 8 9−13% 8 6 25% 4 9 36 36 0% 27 27 0% 18 15 17% 18 10 44% 9 4 36 36 0% 2020 0% 12 15 −25% 8 9 −13% 9 9 81 81 0% 45 45 0% 27 25 7% 18 15 17% 4 832 32 0% 24 24 0% 16 15 6% 16 10 38% 4 13 52 52 0% 39 39 0% 26 21 19% 2614 46% 9 8 72 72 0% 40 40 0% 24 25 −4% 16 15 6% 9 13 117 117 0% 65 65 0%39 35 10% 26 21 19% 8 4 32 32 0% 20 20 0% 12 15 −25% 8 9 −13% 8 9 72 720% 45 45 0% 27 25 7% 18 15 17% 13 4 52 52 0% 28 28 0% 16 21 −31% 12 120% 13 9 117 117 0% 63 63 0% 36 35 3% 27 20 26% 8 8 64 64 0% 40 40 0% 2425 −4% 16 15 6% 8 13 104 104 0% 65 65 0% 39 35 10% 26 21 19% 13 8 104104 0% 56 56 0% 32 35 −9% 24 20 17% 13 13 169 169 0% 91 91 0% 52 49 6%39 28 28% 8 16 128 128 0% 80 80 0% 48 45 6% 32 27 16% 8 21 168 168 0%105 105 0% 63 55 13% 42 33 21% 13 16 208 208 0% 112 112 0% 64 63 2% 4836 25% 13 21 273 273 0% 147 147 0% 84 77 8% 63 44 30% 16 8 128 128 0% 7272 0% 40 45 −13% 24 25 −4% 16 13 208 208 0% 117 117 0% 65 63 3% 39 3510% 21 8 168 168 0% 88 88 0% 48 55 −15% 32 30 6% 21 13 273 273 0% 143143 0% 78 77 1% 52 42 19% 16 16 256 256 0% 144 144 0% 80 81 −1% 48 45 6%16 21 336 336 0% 189 189 0% 105 99 6% 63 55 13% 21 16 336 336 0% 176 1760% 96 99 −3% 64 54 16% 21 21 441 441 0% 231 231 0% 126 121 4% 84 66 21%TOTAL 19751 19751 0% 10778 10778 0% 6111 5884 4% 4241 3338 21% Predic-tion 128 256 512 H V Linear Array Saved Linear Array Saved Linear ArraySaved 4 4 8 4 50% 8 4 50% 8 4 50% 4 9 18 6 67% 18 6 67% 18 4 78% 9 4 8 625% 8 4 50% 8 4 50% 9 9 18 9 50% 18 6 67% 18 4 78% 4 8 16 6 63% 16 6 63%16 4 75% 4 13 26 8 69% 26 8 69% 26 6 77% 9 8 16 9 44% 16 6 63% 16 4 75%9 13 26 12 54% 26 8 69% 26 6 77% 8 4 8 6 25% 8 4 50% 8 4 50% 8 9 18 950% 18 6 67% 18 4 78% 13 4 8 8 0% 8 6 25% 8 6 25% 13 9 18 12 33% 18 950% 18 6 67% 8 8 16 9 44% 16 6 63% 16 4 75% 8 13 26 12 54% 26 8 69% 26 677% 13 8 16 12 25% 16 9 44% 16 6 63% 13 13 26 16 38% 26 12 54% 26 9 65%8 16 32 15 53% 32 10 69% 32 6 81% 8 21 42 18 57% 42 12 71% 42 8 81% 1316 32 20 38% 32 15 53% 32 9 72% 13 21 42 24 43% 42 18 57% 42 12 71% 16 816 15 6% 16 9 44% 16 6 63% 16 13 26 20 23% 26 12 54% 26 9 65% 21 8 24 1825% 16 12 25% 16 8 50% 21 13 39 24 38% 26 16 38% 26 12 54% 16 16 32 2522% 32 15 53% 32 9 72% 16 21 42 30 29% 42 18 57% 42 12 71% 21 16 48 3038% 32 20 38% 32 12 63% 21 21 63 36 43% 42 24 43% 42 16 62% TOTAL 32661895 42% 2888 1317 54% 2888 916 68%

Table 6 shows that, for a memory word organization such as the one inTable 1, an array architecture allows achieving significant memorybandwidth savings for memory bus widths of 64 bits and higher. The entryon the first line in Table 6 (H=4, V=4) in the 64-bit word size columncorresponds to the arrangement of FIGS. 4-A-B.

Table 7 lists computed worst-case maximum bandwidth requirements, inMbytes/sec, for an H.264 decoder at different levels and memory buswidths, for linear and array memory word organizations. Table 7 alsolists the corresponding maximum memory clock speed required for aDDR-SDRAM memory. The physical DDR memory bus width is half of the widthused in computing the bandwidth requirements, as both edges of the clockare used to transfer data, and data is always transferred in pairs. Theworst-case bandwidth required for bit-buffer write, bit-buffer read,deblocking read, pixel write, and display operations is almostindependent of the memory bus width and whether the memory wordorganization is linear or array-based. The prediction bandwidth, whichdepends on whether the memory word organization is linear orarray-based, constitutes the bulk of the required bandwidth. Dependingon the level and memory organization, 53% to 97% of the memory bandwidthrequired by an H.264 decoder can be required to read temporalpredictions. The suffix L following the listed width values represents alinear memory word organization, while the suffix A denotes an arraymemory word organization.

TABLE 7 H.264 Levels Width 1 (QSIF) 1.1 1.2 1.3 2 (SIF) 2.1 2.2 Max.Bit-Rate [Mbits/sec] 0.064 0.192 0.384 0.768 2.000 4.000 4.000 Max.Macroblocks/sec 1,485 3,000 6,000 11,880 11,880 19,800 20,250 Bit-BufferWrite 0 0 0 0 0 1 1 Bit-Buffer Read 0 0 0 1 3 5 5 Prediction Read  8 511 21 42 42 70 72  16 6 12 23 46 46 76 78  32L 7 14 28 56 56 94 96  64L11 22 43 85 85 142 145 128L 21 43 86 170 170 284 290 256L 43 86 172 341341 568 581 512L 85 172 344 681 681 1,135 1,161  32A 6 13 26 52 52 86 88 64A 8 16 32 64 64 106 109 128A 10 20 40 79 79 132 135 256A 15 31 61 122122 203 207 512A 24 49 98 195 195 324 332 Deblocking Read 0 0 1 2 2 3 3Pixel Write 1 1 2 5 5 8 8 Display (2 × 4:2:2) 2 3 6 12 12 20 21 TOTALBandwidth  8 8 16 31 62 63 106 109  16 8 16 33 65 67 112 114  32L 9 1938 76 77 130 133  64L 13 26 53 104 106 178 182 128L 24 48 96 190 191 320327 256L 45 91 182 360 362 604 617 512L 88 177 354 701 702 1,171 1,198 32A 9 18 36 71 73 122 125  64A 10 21 42 83 85 142 145 128A 12 25 50 98100 168 171 256A 18 36 71 141 143 239 244 512A 27 54 108 214 216 360 368Memory Clock (DDR) x4 8 16 31 62 63 106 109 x8 4 8 16 32 33 56 57 x16L 25 10 19 19 32 33 x32L 2 3 7 13 13 22 23 x64L 1 3 6 12 12 20 20 x128L 1 36 11 11 19 19 x256L 1 3 6 11 11 18 19 x16A 2 4 9 18 18 31 31 x32A 1 3 510 11 18 18 x64A 1 2 3 6 6 10 11 x128A 1 1 2 4 4 7 8 x256A 0 1 2 3 3 6 6H.264 Levels Width 3 (SD) 3.1 3.2 4 (HD) 4.1 5 5.1 Max. Bit-Rate[Mbits/sec] 10.000 14.000 20.000 20.000 50.000 135.000 240.000 Max.Macroblocks/sec 40,500 108,000 216,000 245,760 245,760 552,960 983,040Bit-Buffer Write 1 2 3 3 6 17 30 Bit-Buffer Read 13 18 25 25 63 169 300Prediction Read  8 111 226 451 513 513 1,155 2,053  16 119 238 477 543543 1,221 2,171  32L 148 283 567 645 645 1,451 2,579  64L 228 418 836952 952 2,141 3,806 128L 456 719 1,438 1,636 1,636 3,681 6,543 256L 9121,438 2,875 3,272 3,272 7,361 13,086 512L 1,825 2,875 5,751 6,543 6,54314,722 26,172  32A 130 256 511 582 582 1,309 2,328  64A 161 304 608 692692 1,557 2,768 128A 187 346 691 786 786 1,769 3,146 256A 290 511 1,0231,164 1,164 2,619 4,656 512A 415 719 1,438 1,636 1,636 3,681 6,543Deblocking Read 5 14 28 31 31 71 126 Pixel Write 16 41 83 94 94 212 377Display (2 × 4:2:2) 41 111 221 252 252 566 1,007 TOTAL Bandwidth  8 187411 810 918 959 2,190 3,893  16 195 424 836 948 989 2,256 4,011  32L 224469 926 1,050 1,091 2,486 4,419  64L 304 603 1,196 1,357 1,398 3,1765,646 128L 532 904 1,797 2,041 2,082 4,715 8,383 256L 988 1,623 3,2353,677 3,718 8,396 14,926 512L 1,901 3,061 6,110 6,948 6,989 15,75728,012  32A 206 441 871 987 1,028 2,344 4,168  64A 237 489 968 1,0971,138 2,592 4,608 128A 263 531 1,050 1,191 1,233 2,804 4,986 256A 366697 1,382 1,569 1,610 3,654 6,496 512A 491 904 1,797 2,041 2,082 4,7158,383 Memory Clock (DDR) x4 187 411 810 918 959 2,190 3,893 x8 98 212418 474 494 1,128 2,005 x16L 56 117 232 262 273 621 1,105 x32L 38 75 149170 175 397 706 x64L 33 56 112 128 130 295 524 x128L 31 51 101 115 116262 466 x256L 30 48 95 109 109 246 438 x16A 51 110 218 247 257 586 1,042x32A 30 61 121 137 142 324 576 x64A 16 33 66 74 77 175 312 x128A 11 2243 49 50 114 203 x256A 8 14 28 32 33 74 131

Current commercially available, cost-effective DDR memories use a clockfrequency of 100 MHz to 166 MHz. More expensive DDR-II memories employclock frequencies of 133 MHz to 266 MHz. The memory clock data in Table7 show that, for H.264 levels 4 and above, a linear memory organizationwould require currently-impractical memory clock speeds, even for arelatively-wide, 256-bit memory bus. An array memory word architectureas described above allows the use of lower memory clock frequencies.Even for H.264 levels lower than 4, the array architecture may bepreferred since it frees memory bandwidth for other functions integratedon the same chip.

An H.264 level 4 decoder with an array word organization can use 16-bitDDR-II or 32-bit DDR. If a linear word organization were used, thedecoder would need 32-bit DDR-II or 64-bit DDR. The choice of memorytype and bus width can have a significant impact on system cost andpower consumption. For a linear word organization, the worst-case memorybandwidth required for level 5.1 cannot be supported under 266 MHz, evenif a 256-bit memory bus is used. If an array word organization is used,128-bit DDR-II or 256 DDR offer sufficient memory bandwidth for level5.1.

FIGS. 7-A-D and 8-A-D show computed memory bandwidth savings, expressedas a percentage of total memory cycles, resulting from combining two 9×4predictions, for a 32-bit memory bus with linear and array wordorganizations, respectively. The savings are shown as a function of therelative positions of the two predictions, for each possible positionphase of the first reference. The central number in each figure sectioncorresponds to coinciding upper-left corners for the two predictions.Because the two predictions are identical in size in this example,coinciding upper-left corners correspond to a 100% prediction overlapand memory bandwidth savings of 50%. As shown, in some cases memorybandwidth can be saved even if the two predictions do not overlap or area few pels apart. Similar savings in memory cycles are obtained for bothLinear and Array word organizations. Similar results can be obtained forother prediction sizes.

It will be clear to one skilled in the art that the above embodimentsmay be altered in many ways without departing from the scope of theinvention. For example, a video decoder can be provided as part of anencoder, for providing reference frame data used in the encodingprocess. Accordingly, the scope of the invention should be determined bythe following claims and their legal equivalents.

What is claimed is:
 1. A video coding method comprising: determining afirst number of memory access clock cycles needed to retrieve a firstprediction according to motion compensation from random access memory;determining a second number of memory access clock cycles needed toretrieve a second prediction according to motion compensation from therandom access memory, the second prediction being distinct from thefirst prediction; determining a third number of memory access clockcycles needed to retrieve a combined prediction containing the firstprediction and the second prediction from the random access memory;comparing the third number of clock cycles with a sum of the firstnumber of clock cycles and the second number of clock cycles; andsending to the random access memory a memory read command to retrievethe combined prediction from the random access memory when the thirdnumber of clock cycles is less than or equal to the sum of the firstnumber of clock cycles and the second number of clock cycles.
 2. Themethod of claim 1, further comprising adding the first prediction to afirst residual to generate a first target data set, and adding thesecond prediction to a second residual to generate a second target dataset.
 3. The method of claim 1, further comprising performing a firstsubtraction operation between a first target data set and the firstprediction to generate a first residual, and a second subtractionoperation between a second target data set and the second prediction togenerate a second residual.
 4. The method of claim 1, whereindetermining the third number of memory access clock cycles comprisesdetermining that the first prediction overlaps the second prediction. 5.The method of claim 1 wherein determining the third number of memoryaccess clock cycles comprises determining that the first prediction doesnot overlap the second prediction.
 6. The method of claim 1, whereindetermining the third number of memory access clock cycles comprisesdetermining that an area of the combined prediction is defined by arectangle of minimal area that contains an area of the first predictionand an area of the second prediction and that contains an integer numberof memory words.
 7. The method of claim 1, further comprising evaluatingwhether to combine the first prediction with each of a plurality ofpredictions.
 8. The method of claim 7, further comprising evaluatingwhether to combine the combined prediction with each of at least asubset of the plurality of predictions.
 9. The method of claim 1,further comprising retrieving the combined prediction from the randomaccess memory when the third number of clock cycles is less than orequal to the sum of the first number of clock cycles and the secondnumber of clock cycles.
 10. The method of claim 1, wherein determiningthe third number of memory access clock cycles comprises determiningthat the combined prediction includes an image part present in neitherof the first prediction nor of the second prediction.
 11. The method ofclaim 1, wherein in determining the first number of memory access clockcycles and determining the second number of memory access clock cycles,each of the first prediction and the second prediction is smaller thanor equal to a macroblock.
 12. The method of claim 11, wherein indetermining the first number of memory access clock cycles anddetermining the second number of memory access clock cycles, each of thefirst prediction and the second prediction has a luminance size of 4×4,4×8, 8×4, 8×8, 16×8 or 16×16.
 13. A video coding method comprising:comparing a memory bandwidth requirement for retrieving a combinedprediction containing a first prediction according to motioncompensation and a second prediction according to motion compensationfrom a random access memory with a memory bandwidth requirement forretrieving individually the first prediction and the second predictionfrom the random access memory; and retrieving from the random accessmemory either the combined prediction or the first and secondpredictions individually according to a comparison of the memorybandwidth requirement for retrieving the combined prediction to thememory bandwidth requirement for retrieving individually the firstprediction and the second prediction.
 14. The method of claim 13,wherein in comparing the memory bandwidth requirement for retrieving acombined prediction, the first prediction overlaps the secondprediction.
 15. The method of claim 13, wherein in comparing the memorybandwidth requirement for retrieving a combined prediction, the firstprediction does not overlap the second prediction.
 16. The method ofclaim 13, wherein in comparing the memory bandwidth requirement forretrieving a combined prediction, an area of the combined prediction isdefined by a rectangle of minimal area that contains an area of thefirst prediction and an area of the second prediction, and that containsan integer number of memory words.
 17. The method of claim 13, furthercomprising evaluating whether to combine the first prediction with eachof a plurality of predictions.
 18. The method of claim 17, furthercomprising evaluating whether to combine the combined prediction witheach of at least a subset of the plurality of predictions.
 19. Themethod of claim 13, comprising retrieving the combined prediction whenthe memory bandwidth requirement for retrieving the combined predictionis not larger than the memory bandwidth requirement for retrievingindividually the first prediction.
 20. The method of claim 13, whereinin comparing the memory bandwidth requirement for retrieving a combinedprediction, the combined prediction includes an image part present inneither of the first prediction nor of the second prediction.
 21. Themethod of claim 13, wherein in comparing the memory bandwidthrequirement for retrieving a combined prediction, each of the firstprediction and the second prediction is smaller than or equal to amacroblock.
 22. The method of claim 21, wherein in comparing the memorybandwidth requirement for retrieving a combined prediction, each of thefirst prediction and the second prediction has a luminance size of 4×4,4×8, 8×4, 8×8, 16×8 or 16×16.
 23. A video coding apparatus comprising:comparison logic for comparing a memory bandwidth requirement forretrieving a combined prediction containing a first prediction accordingto motion compensation and a second prediction according to motioncompensation from a random access memory with a memory bandwidthrequirement for retrieving individually the first prediction and thesecond prediction from the random access memory; and memory access logicconnected to the comparison logic, for retrieving the combinedprediction or the first and second predictions individually according toa result of complaining the memory bandwidth requirement for retrievingthe combined prediction to the memory bandwidth requirement forretrieving individually the first prediction and the second prediction.24. The apparatus of claim 23, wherein the comparison logic furtherdetermines that the first prediction overlaps the second prediction. 25.The apparatus of claim 23, wherein the memory access logic is configuredto retrieve the combined prediction when the memory bandwidthrequirement for retrieving the combined prediction is not larger thanthe memory bandwidth requirement for retrieving individually the firstprediction and the second prediction.
 26. The apparatus of claim 23,wherein the comparison logic further determines that the combinedprediction includes an image part present in neither of the firstprediction and the second prediction.
 27. The apparatus of claim 23,wherein the comparison logic further receives the first prediction andthe second prediction, and each of the first prediction and the secondprediction is smaller than or equal to a macroblock.
 28. The apparatusof claim 27, wherein the comparison logic further receives the firstprediction and the second prediction, and each of the first predictionand the second prediction has a luminance size of 4×4, 4×8, 8×4, 8×8,16×8 or 16×16.
 29. A video coding apparatus comprising: means forcomparing a memory bandwidth requirement for retrieving a combinedprediction containing a first prediction according to motioncompensation and a second prediction according to motion compensationfrom a random access memory with a memory bandwidth requirement forretrieving individually the first prediction and the second predictionfrom the random access memory; and means for retrieving the combinedprediction or the first and second predictions individually according toa result of comparing of the memory bandwidth requirement for retrievingthe combined prediction to the memory bandwidth requirement forretrieving individually the first prediction and the second prediction.30. The apparatus of claim 29, wherein the means for comparing determinethat the first prediction overlaps the second prediction.
 31. Theapparatus of claim 29, wherein the means for retrieving either thecombined prediction or the first and second predictions individually areconfigured to retrieve the combined prediction when the memory bandwidthrequirement for retrieving the combined prediction is not larger thanthe memory bandwidth requirement for retrieving individually the firstprediction and the second prediction.
 32. The apparatus of claim 29,wherein the means for comparing determine that the combined predictionincludes an image part present in neither of the first prediction andthe second prediction.
 33. The apparatus of claim 29, wherein the meansfor comparing receive the first prediction and the second prediction andeach of the first prediction and the second prediction is smaller thanor equal to a macroblock.
 34. The apparatus of claim 33, wherein themeans for comparing receive the first prediction and the secondprediction and each of the first prediction and the second predictionhas a luminance size of 4×4, 4×8, 8×4, 8×8, 16×8 or 16×16.